## 辅助函数
# 点积
dot <- function(a,b){
  v = sum(a * b)
  return(v)
}
# 叉积
cross <- function(a, b) {
  
  c1 <- a[2] * b[3] - a[3] * b[2]
  c2 <- a[3] * b[1] - a[1] * b[3]
  c3 <- a[1] * b[2] - a[2] * b[1]
  
  c <- c(c1, c2, c3)
  return(c)
}
# 归一化
norms <- function(vec){
  return(vec/sqrt(sum(vec^2)))
}